#include <stdio.h>
#include <stdbool.h>

bool isUgly(int n)
{
    while(n != 0)
    {
        if(n % 5 == 0)
            n /= 5;
        if(n % 3 == 0)
            n /= 3;
        if(n % 2 == 0)
            n /= 2;
        if(n == 1 || n == 2)
            return true;
        if(n % 5 != 0 && n % 3 != 0 && n % 2 != 0)
            return false;
    }
    return true;
}

int main()
{
    int n = 45;
    if(isUgly(n))
        printf("true\n");
    else
        printf("false\n");

    return 0;
}